import Vue from 'vue'
import Router from 'vue-router'
import index from '@/components/index/pages/index'
import login from '@/components/index/pages/login'
import learn from '@/components/index/pages/learn'
import video from '@/components/index/pages/video'

//后台
import admin from '@/components/admin/index.vue'
import home from '@/components/admin/pages/home.vue'
//公司管理
import companyIndex from '@/components/admin/pages/company/index.vue'
import companyInfo from '@/components/admin/pages/company/info.vue'
import companyAdd from '@/components/admin/pages/company/add.vue'
import companyEdit from '@/components/admin/pages/company/edit.vue'
//子公司
import childCompany from '@/components/admin/pages/customer/childCompany.vue'
import childCompanyAdd from '@/components/admin/pages/customer/childCompanyAdd.vue'
import childCompanyEdit from '@/components/admin/pages/customer/childCompanyEdit.vue'
//客户代理
import customerProxy from '@/components/admin/pages/customer/proxy.vue'
import customerProxyAdd from '@/components/admin/pages/customer/proxyAdd.vue'
import customerProxyEdit from '@/components/admin/pages/customer/proxyEdit.vue'
//客户列表
import customerList from '@/components/admin/pages/customer/list.vue'
import customerListAdd from '@/components/admin/pages/customer/customerAdd.vue'
import customerListEdit from '@/components/admin/pages/customer/customerEdit.vue'
//管理员
import adminList from '@/components/admin/pages/admin/list.vue'
import adminAdd from '@/components/admin/pages/admin/add.vue'
import adminEdit from '@/components/admin/pages/admin/edit.vue'
//角色
import roleList from '@/components/admin/pages/role/list.vue'
import roleAdd from '@/components/admin/pages/role/add.vue'
import roleEdit from '@/components/admin/pages/role/edit.vue'
//日志列表
import dataList from '@/components/admin/pages/data/list.vue'
//模块管理
import settingList from '@/components/admin/pages/setting/index.vue'
import settingAdd from '@/components/admin/pages/setting/add.vue'
Vue.use(Router)

// !!!!!!!!!!!!!!!警告!!!!!!!!!!!!!!!
// 所有侧边栏能点击的路由 必须为顶级嵌套
// 如客户列表，必须为app_name+/customer-list
// 其余路由可自由基于/customer-list后添加 如/customer-list/add 、 /customer-list/edit
// 如果是节点权限路由 请写到下面的异步路由中

//直接加载路由
export const constantRouterMap = [
  {
    path: '/',
    name: 'index',
    component: index,
  },
  {
    path: '/login',
    name: 'login',
    component: login,
  },
  {
    path: '/learn',
    name: 'learn',
    component: learn,
  },
  {
    path: '/video',
    name: 'video',
    component: video,
  },
  {
    path: '/admin',
    name: 'admin',
    component: admin,
    children:[
      {
        path:'/',
        name:'home',
        component:home,
      },
      {
        path:'/setting-list',
        name:'settingList',
        component:settingList,
      },
      {
        path:'/company',
        name:'companyIndex',
        component: companyIndex,
      },
      {
        path:'/company/info',
        name:'companyInfo',
        component: companyInfo,
      },
      {
        path:'/company/add',
        name:'companyAdd',
        component: companyAdd,
      },
      {
        path:'/company/edit',
        name:'companyEdit',
        component: companyEdit,
      },
      {
        path:'/admin-list',
        name:'adminList',
        component:adminList,
        isSlide:true,
      },
      {
        path:'/admin-list/add',
        name:'adminAdd',
        component:adminAdd,
        isSlide:true,
      },
      {
        path:'/admin-list/edit',
        name:'adminEdit',
        component:adminEdit,
        isSlide:true,
      },
      {
        path:'/role-list',
        name:'roleList',
        component:roleList,
        isSlide:true,
      },
      {
        path:'/role-list/add',
        name:'roleAdd',
        component:roleAdd,
        isSlide:true,
      },
      {
        path:'/role-list/edit',
        name:'roleEdit',
        component:roleEdit,
        isSlide:true,
      },
      {
        path:'/child-company',
        name:'childCompany',
        component: childCompany,
        isSlide:true,
      },
      {
        path:'/child-company/add',
        name:'childCompanyAdd',
        component: childCompanyAdd,
        isSlide:true,
      },
      {
        path:'/child-company/edit',
        name:'childCompanyEdit',
        component: childCompanyEdit,
        isSlide:true,
      },
      {
        path:'/proxy',
        name:'customerProxy',
        component:customerProxy,
        isSlide:true,
      },
      {
        path:'/proxy/add',
        name:'customerProxyAdd',
        component:customerProxyAdd,
        isSlide:true,
      },
      {
        path:'/proxy/edit',
        name:'customerProxyEdit',
        component:customerProxyEdit,
        isSlide:true,
      },
      {
        path:'/customer-list',
        name:'customerList',
        component:customerList,
        isSlide:true,
      },
      {
        path:'/customer-list/add',
        name:'customerListAdd',
        component:customerListAdd,
        isSlide:true,
      },
      {
        path:'/customer-list/edit',
        name:'customerListEdit',
        component:customerListEdit,
        isSlide:true,
      },
      {
        path:'/data-list',
        name:'dataList',
        component:dataList,
        isSlide:true,
      },
    ]
  }
]

export default new Router({
  mode:'history',
  routes: constantRouterMap
})